import Vue from 'vue'
import store from '@/store'

/**
 * 自定义指令
 */

// 权限指令
Vue.directive('permissions', {
    inserted: function(el, binding) {
        const { value } = binding;
        const { permissions } = store.state.auth;
        if (value && permissions.indexOf(value) === -1 && el.parentNode) {
            el.parentNode.removeChild(el)
        }
    }
})
